<?php

namespace App\HttpController;

use EasySwoole\Core\Http\AbstractInterface\Controller;

/**
 * Class Index
 * @package App\HttpController
 */
class Index extends Controller
{
    /**
     * 首页方法
     * @author : evalor <master@evalor.cn>
     */
    function index()
    {
        //$this->response()->write(111111);
        // $this->response()->withHeader('Content-type', 'text/html;charset=utf-8');
        // $this->response()->write('<div style="text-align: center;margin-top: 30px"><h2>欢迎使用EASYSWOOLE</h2></div></br>');
        // $this->response()->write('<div style="text-align: center">您现在看到的页面是默认的 Index 控制器的输出</div></br>');
        // $this->response()->write('<div style="text-align: center"><a href="https://www.easyswoole.com/Manual/2.x/Cn/_book/Base/http_controller.html">查看手册了解详细使用方法</a></div></br>');
    }

    function reg(){
        //header('Access-Control-Allow-Origin:*');
        // $this->response()->withHeader("Access-Control-Allow-Origi","*");
        // //get
        // //$param = $this->request()->getQueryParams();
        // //post 
        // $param = $this->request()->getParsedBody();
        
        // //$username = $param["username"];
        // //$password = $param["password"];

        // $model = new \App\Socket\Model\User();
        // $msg = [];

        // try{
        //     $model->allowField(['username','password'])->data($param)->save();
        //     $msg["cmd"] = "success";            
        // }catch(\Exception $e){
        //     $msg["cmd"] = "error";
        //     $msg["data"] = [
        //         "msg"=>"帐号已存在"
        //     ];
        // }
       
        // $this->response()->write( json_encode($msg) );
    }
}